# -*- coding: utf-8 -*-
from modelscope import AutoModelForMaskedLM, AutoTokenizer
model_dir = '/root/autodl-tmp//models/pretrained/google-bert/bert-base-chinese'
# 对应MLM任务
model = AutoModelForMaskedLM.from_pretrained(model_dir)
tokenizer = AutoTokenizer.from_pretrained(model_dir)
print(model)
print(model.config)




# # -*- coding: utf-8 -*-
# from transformers import AutoModel, AutoTokenizer, AutoModelForMaskedLM
# model_dir = "/tmp/code/bert_fine_tuning/models/pretrained/google-bert/bert-base-chinese"
# # 加载分词器
# tokenizer = AutoTokenizer.from_pretrained(model_dir)
# # 加载BERT底层模型（不带任务头）
# model = AutoModel.from_pretrained(model_dir)
# # 如果需要MLM任务，就用下面这一行替代
# # model = AutoModelForMaskedLM.from_pretrained(model_dir)
# print(model)
# print(model.config)
